#if 0
自定义类表示分数（Fraction）。
	要求：
			1、有成员属性denominator（分母，整型），numerator（分子，整型）
			2、将denominator，numerator设为私有属性，并提供公开的get，set函数。
			3、有合理的构造函数
#endif 
#include <iostream>
using namespace std;

class Fraction{
private:
	int 	*denominator;
	int 	*numerator;
public:
	Fraction(int denominator, int numerator);
	Fraction();
	~Fraction();
	//set get...

	void display();
};

Fraction::Fraction()
	:denominator(0),
	numerator(0)
{

}

Fraction::~Fraction()
{
	if(this->denominator)		delete this->denominator;
	if(this->numerator)			delete this->numerator;
}

void Fraction::display()
{
	cout << *this->numerator << " / " << *this->denominator << endl;
}

Fraction::Fraction(int denominator, int numerator)
	//:denominator(denominator),
	//numerator(numerator)
{
	//this->denominator = &denominator;
	this->denominator = new int(denominator);
	this->numerator = new int(numerator);

	//int *p = new int(100);
}

int main(int argc, char **argv)
{
	Fraction *f = new Fraction(5, 4);
	if(0 == f)		return -1;
	f->display();

	if(f)		delete f;


	return 0;
}
